package net.neimeng.luculent.commonmodule;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.view.WindowManager;

import com.alibaba.android.arouter.launcher.ARouter;
import com.blankj.utilcode.util.SPUtils;

import net.neimeng.luculent.commonmodule.router.CommonRouterPath;
import net.neimeng.luculent.coremodel.datamodel.http.RetrofitUtils;
import net.neimeng.luculent.coremodel.utils.Logger;
import net.neimeng.luculent.coremodel.utils.SPConstant;


public class SplashActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN
                ,WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);

        //延迟500ms跳转
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                String token = SPUtils.getInstance().getString(SPConstant.HTTP_TOKEN, "");
                Logger.e("token====",token);
                if(token.equals("")){
                    ARouter.getInstance().build(CommonRouterPath.LOGIN).navigation();
                }else{
                    ARouter.getInstance().build(CommonRouterPath.MAIN).navigation();
                }
                finish();
            }
        }, 500);
    }
}
